package albert3d.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;


public class ObslugaBledu {
	
	public ObslugaBledu(String tekstBledu) {
		
		final JDialog okno = new JDialog();
		
		Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension size = kit.getScreenSize();		
		okno.setLocation((size.width/2)-400, (size.height/2)-70);
		
    	okno.setResizable(false);
    	okno.setTitle("ERROR!");
    	okno.setSize(800, 140);
    	okno.setModal(true);
    	
    	JPanel panel = new JPanel();
    	panel.setLayout(null);
    	
    	JLabel napis = new JLabel();
    	napis.setFont(new Font("Tahoma", Font.BOLD, 16));
    	napis.setForeground(Color.RED);
    	napis.setText("ERROR: " + tekstBledu);
    	napis.setBounds(10, 10, 780, 20);
    	
    	JButton ok = new JButton();
    	ok.setText("OK");
    	ok.setBounds(350, 70, 100, 25);
    	ok.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				okno.setVisible(false);
			}
		});

    	
    	panel.add(napis);
    	panel.add(ok);
    	
    	okno.add(panel);
    	okno.setVisible(true);
    	
		
	}
	
}
